package controller;

import model.Department;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.DepartmentService;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@Controller
@ResponseBody
@RequestMapping("/department")
public class DepartmentController {
    @Resource
    private DepartmentService service;

    @RequestMapping("/findAll.do")
    public Map<String,Object> findAll(){
        List<Department> list = service.findAll();
        Map<String,Object> map = new HashMap<>();
        map.put("code","200");
        map.put("msg","");
        map.put("data",list);
        return map;

    }
}
